package com.dap.cms.governance.service.impl;

import com.dap.cms.base.impl.BaseServiceImpl;
import com.dap.cms.governance.exception.ServiceException;
import com.dap.cms.governance.po.CmsCompanyPo;
import com.dap.cms.governance.po.CmsSysPo;
import com.dap.cms.governance.po.CmsUserPo;
import com.dap.cms.governance.service.*;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @description: t_cms_sys表对应的服务接口实现类
 * @author: Fesine
 * @createTime:2018/08/20
 * @update:修改内容
 * @author: Fesine
 * @updateTime:2018/08/20
 */
@Service
public class CmsSysServiceImpl extends BaseServiceImpl<CmsSysPo>
        implements CmsSysService {
    @Autowired
    private CmsUserService cmsUserService;


    @Autowired
    private CmsCompanyService cmsCompanyService;


    @Override
    public Boolean check(String companyName, String sysName) {
        CmsCompanyPo cmsCompanyPo = new CmsCompanyPo();
        cmsCompanyPo.setCompanyName(companyName);
        cmsCompanyPo = cmsCompanyService.get(cmsCompanyPo);
        if (null != cmsCompanyPo) {
            CmsSysPo cmsSysPo = new CmsSysPo();
            cmsSysPo.setCompanyId(cmsCompanyPo.getId());
            cmsSysPo.setSysName(sysName);
            cmsSysPo = get(cmsSysPo);
            return null != cmsSysPo;
        }
        return false;
    }
}

